﻿Imports System.Data.OleDb

Public Class Maintenance
    Inherits System.Web.UI.Page

  

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_Submit.Click

        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("PhonesConn").ConnectionString)
        Dim sql As String = "INSERT INTO Maintenance (Title,DateCreated,UserFkID) VALUES (@f1,@f2,@f3)"
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
        cmd.Parameters.AddWithValue("@f1", tb_Maintenance.Text)
        cmd.Parameters.AddWithValue("@f2", Now.Date.ToString("dd/MM/yyyy"))
        cmd.Parameters.AddWithValue("@f3", Membership.GetUser(User.Identity.Name).ProviderUserKey)
        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("Maintenance.aspx")
    End Sub
End Class